#include<stdio.h>

int lengthOfLongestSubstring(char * s){
   int start=0;
   int end=0;
   int maxlen=0;

   char map[256]={0};
    map[(int)* (s+start)] =1;

   while(*(s+end) !=0){
       maxlen=maxlen > (end - start + 1)? maxlen:(end - start + 1);
       ++end;
       while(0 != map[(int)* (s+end)]){
           map[(int)* (s+start)] =0;
           ++start;
       }
       map[(int)* (s+end)] =1;
   }

   return maxlen;
}

